package com.muyu.system.domain.model;

import com.muyu.common.core.web.model.QueryModel;
import com.muyu.system.domain.req.SysOperlogListReq;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.Date;


/**
 * 参数配置 分页 模型
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class SysOperlogPageQueryModel extends QueryModel<SysOperlogPageQueryModel> {
    /**
     * 操作地址
     */
    private String operIp;
    /**
     * 操作模块
     */
    private String title;
    /**
     * 操作人员
     */
    private String operName;
    /**
     * 业务类型（0其它 1新增 2修改 3删除）
     */
    private Integer businessType;
    /**
     * 操作状态（0正常 1异常）
     */
    private Integer status;
    /**
     * 开始时间
     */
    private Date beginTime;
    /**
     * 结束时间
     */
    private Date endTime;

    public static SysOperlogPageQueryModel reqBuild(SysOperlogListReq sysOperlogListReq) {
        SysOperlogPageQueryModel sysOperlogPageQueryModel = SysOperlogPageQueryModel.builder()
                .operIp(sysOperlogListReq.getOperIp())
                .title(sysOperlogListReq.getTitle())
                .operName(sysOperlogListReq.getOperName())
                .businessType(sysOperlogListReq.getBusinessType())
                .status(sysOperlogListReq.getStatus())
                .beginTime(sysOperlogListReq.getBeginTime())
                .endTime(sysOperlogListReq.getEndTime())
                .build();
        sysOperlogPageQueryModel.domainBuild(sysOperlogListReq);
        return sysOperlogPageQueryModel;
    }
}
